<?php

/**
 * Library :: DAL (Data Access Layer) :: DataObject
 *
 * Warlock is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 *
 * @package    warlock
 * @author     David Cole <neophyte@sourcetutor.com>
 * @license    GNU/GPL v2
 */

// Object Dependencies
using('Engine.DAL.DataObject');

class DAL_DataObject_audit extends DAL_DataObject
{
    function __construct()
    {
        parent::__construct();

        // Table Properties
        $this->Table      = 'w_engine_audit';
        $this->PrimaryKey = 'id';

        // Field Definitions
        $this->Fields['id']      = array('type' => 'INTEGER', 'size' => '10', 'unsigned' => true, 'autoincrement' => true);
        $this->Fields['nid']     = array('type' => 'INTEGER', 'size' => '10', 'unsigned' => true, 'null' => true);
        $this->Fields['vid']     = array('type' => 'INTEGER', 'size' => '10', 'unsigned' => true, 'null' => true);
        $this->Fields['uid']     = array('type' => 'INTEGER', 'size' => '10', 'unsigned' => true, 'null' => true);
        $this->Fields['type']    = array('type' => 'STRING', 'size' => '32');
        $this->Fields['created'] = array('type' => 'DATETIME', 'autoinsert' => true);
        $this->Fields['message'] = array('type' => 'STRING', 'size' => 'SMALL');

        /*
         * Data Object Relationships
         */

        $this->Relationships[] = array('table'  => 'w_engine_node_revisions',
                                       'do'     => 'noderevisions',
                                       'fields' => array('title' => 'r_title'),
                                       'relate' => array('vid' => 'id'));

        $this->Relationships[] = array('table'  => 'w_engine_users',
                                       'do'     => 'user',
                                       'fields' => array('name'         => 'u_name',
                                                         'display_name' => 'u_display_name',
                                                         'email'        => 'u_email'),
                                       'relate' => array('uid' => 'id'));
    }
}

?>